<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery.min.js"></script>
    <style>
        body{
            margin:0;
            padding:0;
        }
        div{
            background-color: pink;
            width: 100px;
            height: 100px;
            position: absolute;
        }
    </style>
</head>
<body>
    <div id = "box"></div>

    <script>
        $(()=>{
            // 获取盒子
            var movebox = $('#box')
            // 定义节流阀
            var timer = null
            $(document).on('mousemove',(e)=>{
                // 如果节流阀为空则可以使用
                if(timer) return 
                timer = setTimeout(()=>{
                    movebox.css('left',e.pageX+'px').css('top',e.pageY+'px')
                    // 事件执行结束，节流阀置空
                    timer = null
                },16)
            })
        })
    </script>
</body>
</html>